from django.db import models
from mdeditor.fields import MDTextField
from django.contrib.auth.models import User

# Create your models here.

class Post(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    title = models.CharField(max_length=20, default='')
    content_head = MDTextField(default='')
    html_text = models.TextField(default='')
    post_date = models.DateTimeField(auto_now_add=True)

class Reply(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    html_text = models.TextField(default='')
    content = MDTextField(default='')
    post_date = models.DateTimeField(auto_now_add=True)
    build_num = models.IntegerField(default=0)
    post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='replys')